﻿using House.Server.Dto;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace House.Server.WebApi.ViewModel
{
    public class DepartmentViewModel
    {

        /// <summary>
        /// 显示所有部门
        /// </summary>
        /// <returns></returns>
        public static dynamic DepartmentSelect()
        {
            /// <summary>
            /// 调用部门BLL中所有方法
            /// </summary>
            Service.System_DepartmentService Department = new Service.System_DepartmentService();
            return Department.Select();
        }

        /// <summary>
        /// 删除选中部门
        /// </summary>
        /// <returns></returns>
        public static dynamic DepartmentDelete(int id)
        {
            /// <summary>
            /// 调用员工BLL中所有方法
            /// </summary>
            Service.System_StaffService Department = new Service.System_StaffService();
            return Department.DeleteById(id);
        }

        /// <summary>
        /// 添加部门
        /// </summary>
        /// <returns></returns>
        public static dynamic DepartmentAdd(Department list)
        {
            /// <summary>
            /// 调用员工BLL中所有方法
            /// </summary>
            Service.System_DepartmentService Department = new Service.System_DepartmentService();
            return Department.Insert(list);
        }

        /// <summary>
        /// 显示部门(根据Id查询)
        /// </summary>
        /// <returns></returns>
        public static dynamic DepartmentSelect1(int id)
        {
            /// <summary>
            /// 调用部门BLL中所有方法
            /// </summary>
            Service.System_DepartmentService Department = new Service.System_DepartmentService();
            return Department.Select(p => p.D_id == id);
        }
        /// <summary>
        /// 修改信息部门
        /// </summary>
        /// <returns></returns>
       

        public static dynamic DepartmentUpdate(Department list)
        {
            /// <summary>
            /// 调用部门BLL中所有方法
            /// </summary>
            Service.System_DepartmentService Department = new Service.System_DepartmentService();
            return Department.Update(list);
        }


        /// <summary>
        /// 显示部门(查询未删除的部门)
        /// </summary>
        /// <returns></returns>
        public static dynamic DepartmentSelect2(int id)
        {
            /// <summary>
            /// 调用部门BLL中所有方法
            /// </summary>
            Service.System_DepartmentService Department = new Service.System_DepartmentService();
            return Department.DepartmentShow(id);
        }
    }
}